<template>
	<el-form ref="form" :model="form" label-width="80px">
	  <el-form-item label="菜单名称">
	    <el-input v-model="form.MenuName" ></el-input>
	  </el-form-item>
	  <el-form-item label="菜单分级">
	    <el-select v-model="form.PId" placeholder="请选择分级">
			<el-option v-for="pu in Pmenu" :key="pu.Id" :label="pu.MenuName" :value="pu.Id"></el-option>
	    </el-select>
	  </el-form-item>
	  <el-form-item label="菜单地址">
	    <el-input v-model="form.MenuUrl" ></el-input>
	  </el-form-item>
	  <el-form-item label="菜单图标">
	    <el-input v-model="form.MenuIcon" ></el-input>
	  </el-form-item>
	  <el-form-item class="flex-row justify-center" label-width="0">
	    <el-button  type="primary" @click="onSubmit">立即创建</el-button>
	  </el-form-item>
	</el-form>
</template>

<script>
import menuadd from '@/api/MenuApi.js'

	export default {
	    data() {
	      return {
	        form: {
	          MenuName: '',
	          PId: '',
	          MenuUrl: '',
	          MenuIcon: '',
	        
			},
			Pmenu:[]
	      }
	    },
	    methods: {
	      onSubmit() {
	        menuadd.Add(this.form).then(res=>{
				if(res.code==1){
					this.$message("添加成功")
				    this.$emit("CloseAdd")
				}
				
			})
	      }
	    },
		created(){
			menuadd.FuCha().then(res=>{
				this.Pmenu=res.data
			})
		}
	  }
</script>

<style>
</style>